<template>
  <div class="newsinfo">
    <!-- header -->
    <van-panel
      class="my-panel"
      :title="newsinfo.zhaiyao"
      :status="'阅读' + newsinfo.click + '次'"
    >
      <div class="content">
        {{ newsinfo.content }}
      </div>
    </van-panel>
    <!-- 评论组件 -->
    <Comment :id="id"></Comment>
  </div>
</template>
<script>
import Comment from '@/components/Comment';
export default {
  components: {
    Comment,
  },
  props: ['id'],
  data() {
    return {
      newsinfo: {},
    };
  },
  created() {
    this.getNewsInfo();
  },
  methods: {
    async getNewsInfo() {
      const res = await this.$http.getNewsInfo(this.id);
      this.newsinfo = res.data.message;
    },
  },
};
</script>
<style lang="scss">
.newsinfo {
  padding: 0 10px;
  .van-cell__title {
    font-size: 16px;
    font-weight: 600;
  }
  .content {
    text-indent: 2em;
    font-size: 12px;
  }
  .my-panel {
    margin-bottom: 10px;
  }
}
</style>
